package com.wonders.frame.entity;
import com.wonders.frame.core.entity.EntityTemplate;
import org.hibernate.annotations.Where;
import javax.persistence.*;
import java.util.List;
@SuppressWarnings("serial")
@Entity
@Where(clause = " removed = 0 ")
@Table(name = "auth_permission")
public class AuthPermission  extends EntityTemplate implements Comparable<AuthPermission> {
    @Column(name = "code")
    private String code;
    @Column(name = "parent_id")
    private String parentId;
    @OneToMany(cascade={CascadeType.REFRESH, CascadeType.REMOVE}, fetch = FetchType.EAGER)
    @JoinColumn(name = "parent_id")
    @OrderBy(value = "sourceIndex asc")
    private List<AuthPermission> perChildren;
    @Column(name = "source_index")
    private Integer sourceIndex;
    @Column(name = "auth_type")
    private Integer authType;
    @Column(name = "component_text")
    private String componentText;
    @Column(name = "component_key")
    private String componentKey;
    @Column(name = "component_icon_type")
    private String componentIconType;
    @Column(name = "component_link_url")
    private String componentLinkUrl;
    @Column(name = "source_describe")
    private String sourceDescribe;
    @Column(name = "super_manager")
    private String superManager;
    public String getSuperManager() {
        return superManager;
    }
    public void setSuperManager(String superManager) {
        this.superManager = superManager;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getParentId() {
        return parentId;
    }
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    public List<AuthPermission> getPerChildren() {
        return perChildren;
    }
    public void setPerChildren(List<AuthPermission> perChildren) {
        this.perChildren = perChildren;
    }
    public Integer getSourceIndex() {
        return sourceIndex;
    }
    public void setSourceIndex(Integer sourceIndex) {
        this.sourceIndex = sourceIndex;
    }
    public Integer getAuthType() {
        return authType;
    }
    public void setAuthType(Integer authType) {
        this.authType = authType;
    }
    public String getComponentText() {
        return componentText;
    }
    public void setComponentText(String componentText) {
        this.componentText = componentText;
    }
    public String getComponentKey() {
        return componentKey;
    }
    public void setComponentKey(String componentKey) {
        this.componentKey = componentKey;
    }
    public String getComponentIconType() {
        return componentIconType;
    }
    public void setComponentIconType(String componentIconType) {
        this.componentIconType = componentIconType;
    }
    public String getComponentLinkUrl() {
        return componentLinkUrl;
    }
    public void setComponentLinkUrl(String componentLinkUrl) {
        this.componentLinkUrl = componentLinkUrl;
    }
    public String getSourceDescribe() {
        return sourceDescribe;
    }
    public void setSourceDescribe(String sourceDescribe) {
        this.sourceDescribe = sourceDescribe;
    }
    @Override
    public String toString() {
        return "AuthPermission{" +
                "code='" + code + '\'' +
                ", parentId='" + parentId + '\'' +
                ", perChildren=" + perChildren +
                ", sourceIndex=" + sourceIndex +
                ", authType=" + authType +
                ", componentText='" + componentText + '\'' +
                ", componentKey='" + componentKey + '\'' +
                ", componentIconType='" + componentIconType + '\'' +
                ", componentLinkUrl='" + componentLinkUrl + '\'' +
                ", sourceDescribe='" + sourceDescribe + '\'' +
                ", id='" + id + '\'' +
                ", removed=" + removed +
                '}';
    }
    @Override
    public int compareTo(AuthPermission o) {
        return this.sourceIndex - o.getSourceIndex();
    }
}